from src.pages.base_page import BasePage


class HomePage(BasePage):
    def __init__(self, page):
        super().__init__(page)
        self.new_mission_link_button = "a[title='新任务']"
        self.home_page_url = 'https://team.pescms.com/?g=Team&m=Index&a=index'

    def link_to_new_mission_page(self):
        self.page.goto(self.home_page_url)
        self.click(self.new_mission_link_button)

    def set_new_locator(self, elements: list[dict]):
        for element in elements:
            for k, v in element.items():
                setattr(self, k, v)
